/**
  ******************************************************************************
  * @author     Chris
  * @since      2024/6/28 15:40
  *
  * @file       pd_wwdg.h
  * @brief      Header file of Xxx hardware driver.
  *
  * @note       This file contains the Xxx object declaration.
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date          Author       Notes
  *   2024/6/28     Chris        the first version
  *
  ******************************************************************************
  */


#ifndef JLC_SKY_WWDG_H
#define JLC_SKY_WWDG_H

#include "pd_wdg.h"

struct WinWDGVtbl;

/** @defgroup Object properties
  * @{
  */
typedef struct {
    WDG wdg;

    WWDG_TypeDef *WWDGx;
    uint32_t Prescaler; // div 1, 2, 4, 8
    uint32_t Window;    // W[5:0]
    uint32_t Counter;   // T[5:0]

    uint32_t max;       // max window time, watchdog timeout, milliseconds
    uint32_t min;       // min window time, window time, milliseconds

    // WinWDG virtual table
    struct WinWDGVtbl *vptr;
} WinWDG; /* extends from {@see WDG} */
/**
 * @}
 */

/** @defgroup Object virtual table definition
  * @{
  */
struct WinWDGVtbl {
    void (*init)(const WinWDG *this);

};
/**
 * @}
 */

/** @defgroup Object constructor and member function declaration
  * @{
  */
void WinWDG_constructor(WinWDG *this, WWDG_TypeDef *WWDGx, uint32_t Prescaler, uint32_t max, uint32_t min);
/**
 * @}
 */

/** @defgroup Object virtual table function implementation
  * @{
  */
static inline void WinWDG_init(const WinWDG *this) {
    this->vptr->init(this);
}
/**
 * @}
 */


#endif //JLC_SKY_WWDG_H
